package com.bwie.user.myrun;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.bwie.user.dao.ComeDao;
import com.bwie.user.dao.TypeDao;
import com.bwie.user.entity.ComeEntity;
import com.bwie.user.entity.TypeEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.context.annotation.Configuration;

import java.util.List;

@Configuration
public class MyRunner implements ApplicationRunner {


     @Autowired
    ComeDao comeDao;
     @Autowired
    TypeDao typeDao;
    //商品维护系统启动ApplicationRunner进行数据同步，
    // 从数据库中检索商品类型、商品来源信息进行同步（3分）
    @Override
    public void run(ApplicationArguments args) throws Exception {
        System.out.println("系统启动ApplicationRunner进行数据同步------从数据库中检索商品类型、商品来源信息进行同步");
        List<ComeEntity> comeEntities = comeDao.selectList(new QueryWrapper<ComeEntity>());
        System.out.println(comeEntities);
        List<TypeEntity> typeEntities = typeDao.selectList(new QueryWrapper<TypeEntity>());
        System.out.println(typeEntities);
        //

    }
}
